package com.workingpub.commons.jdbc.config;

import java.io.File;
import java.io.InputStream;

import com.workingpub.commons.jdbc.SqlDefineContext;
import com.workingpub.commons.jdbc.binding.SelectEntry;
import com.workingpub.commons.jdbc.binding.SqlDefineEntry;

/**
 * SqlDefine配置文件解析器
 * 
 * @author taoping
 *
 */
public interface SqlDefineResolver {

	/**
	 * 按文件解析,并加入到{@link SqlDefineContext}
	 * 
	 * @param defineFile
	 * @return
	 */
	void addSqlDefine(File defineFile);

	/**
	 * 按输入流解析,并加入到{@link SqlDefineContext}
	 * 
	 * @param defineStream
	 * @return
	 */
	void addSqlDefine(InputStream defineStream);

	/**
	 * 确析单项SQL文本，并加入到{@link SqlDefineContext}
	 * 
	 * @param sqlId
	 * @param sqlText
	 */
	void addQuerySql(String sqlId, String sqlText);

	/**
	 * 确析单项SQL文本，并加入到{@link SqlDefineContext}
	 * 
	 * @param sqlId
	 * @param sqlText
	 * @param domainCode
	 */
	void addQuerySql(String sqlId, String sqlText, String domainCode);

	void removeDefine(InputStream defineStream);

	void removeDefine(File defineFile);

	SelectEntry resolveQuerySql(String sqlId, String sqlText);

	SqlDefineEntry resolve(File defineFile);

	SqlDefineEntry resolve(InputStream defineStream);

	SqlDefineEntry resolve(String defineText);
}
